<div ng-controller='rangeFacet' ng-init="init()" style="min-height:{{panel.height || row.height}}">
  <style>
    .histogram-legend {
      display:inline-block;
      padding-right:5px
    }
    .histogram-legend-dot {
      display:inline-block;
      height:10px;
      width:10px;
      border-radius:5px;
    }
    .histogram-legend-item {
      display:inline-block;
    }
    .histogram-chart {
      position:relative;
    }
    .histogram-options {
      padding: 5px;
      margin-right: 15px;
      margin-bottom: 0px;
    }
    .histogram-options label {
      margin: 0px 0px 0px 10px !important;
    }
    .histogram-options span {
      white-space: nowrap;
    }

    /* this is actually should be in bootstrap */
    .form-inline .checkbox {
        display: inline-block;
    }
  </style>
  <div ng-show='panel.showChart'>
  <div>
    <span ng-show='panel.options'>
      <a class="link underline small" ng-show='panel.options' ng-click="options=!options">
        <i ng-show="!options" class="icon-caret-right"></i><i ng-show="options" class="icon-caret-down"></i> View
      </a> |&nbsp
    </span>
    <span ng-show='panel.zoomlinks && data'>
      <!--<a class='small' ng-click='zoom(0.5)'><i class='icon-zoom-in'></i> Zoom In</a>-->
      <a class='small' ng-click='zoom(2)'><i class='icon-zoom-out'></i> Zoom Out</a> |&nbsp
    </span>
    <span ng-show="panel.legend" ng-repeat='series in data' class="histogram-legend">
      <i class='icon-circle' ng-style="{color: series.info.color}"></i>
      <span class='small histogram-legend-item'>{{series.info.alias}} ({{dashboard.numberWithCommas(series.hits)}})</span>
    </span>
    <span ng-show="panel.legend" class="small"><span ng-show="panel.value_field && panel.mode != 'count'">{{panel.value_field}}</span> {{panel.mode}} per <strong>{{dashboard.numberWithCommas(panel.gap)}} {{panel.unit}}</strong> | (<strong>{{dashboard.numberWithCommas(hits)}}</strong> hits)</span>
  </div>
  <form class="form-inline bordered histogram-options" ng-show="options">
    <span class="checkbox">
      <label class="small">
        <input type="checkbox" ng-model="panel.bars" ng-checked="panel.bars" ng-change="render()">
        Bars
      </label>
    </span>
    <span class="checkbox">
      <label class="small">
        <input type="checkbox" ng-model="panel.lines" ng-checked="panel.lines" ng-change="render()">
        Lines
      </label>
    </span>
    <span class="checkbox">
      <label class="small">
        <input type="checkbox" ng-model="panel.points" ng-checked="panel.points" ng-change="render()">
        Points
      </label>
    </span>
    <span ng-show="panel.auto_int">
      <label class="small">Precision</label> <select ng-disabled="!panel.auto_int" ng-change="set_precision(panel.resolution);get_data();" class="input-small" ng-model="panel.resolution" ng-options="interval_label(time) for time in panel.resolutions"></select>
    </span>
  </form>
  <center><img ng-show='panel.loading && _.isUndefined(data)' src="img/load_big.gif"></center>
  <div rangefacet-chart class="histogram-chart" params="{{panel}}"></div>
  </div>
  <div ng-show='!panel.showChart'>
    <div class="span11">
      <h4>No range filter present</h4>
    </div>
    <a class='btn btn-small' ng-click="range_apply()">Create a range filter</a>
  </div>
</div>